<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { adminGetVideoDetailService } from '@/api/admin'
import { userGetVideoDetailService } from '@/api/user'

const videoId = ref()
const route = useRoute()

const getVideoId = () => {
  videoId.value = route.params.id
  console.log(videoId.value)
}

getVideoId()

const videoData = ref({
  title: '',
  videoUrl: '',
  remark: '',
  createTime: '',
  publisher: ''
})

const getVideoDetail = async () => {
  const res = await userGetVideoDetailService(videoId.value)
  console.log(res.data.data)
  videoData.value = res.data.data
}

getVideoDetail()
</script>

<template>
  <div id="main-teaResourceVideoPlayPage">
    <h1>{{ videoData.title }}</h1>
    <div style="display: flex; margin-top: 20px">
      <div>发布者:{{ videoData.publisher }}</div>
      <div style="margin-left: 20px">{{ videoData.createTime }}</div>
    </div>

    <video :src="videoData.videoUrl" controls></video>
  </div>
</template>

<style scoped>
#main-teaResourceVideoPlayPage {
  width: 100%;
  margin: 20px;
  position: relative;
}

video {
  width: 90%;
  height: auto;
  margin-top: 20px;
}
</style>
